feat(config): resolve active env at runtime from PLAYGROUND_ENV#418
Open
tallesborges wants to merge 1 commit into
Open
feat(config): resolve active env at runtime from PLAYGROUND_ENV#418tallesborges wants to merge 1 commit into
tallesborges wants to merge 1 commit into
Conversation
getChainConfig/getNetworkLabel/getTokenSymbol/getPgasAssetId now default to a new getActiveEnv() that reads PLAYGROUND_ENV (validated against CONFIGS) and falls back to DEFAULT_ENV. This lets the direct-chain layer (getConnection, pairing, registry, drip) follow the selected network, so one build can target any wired env (Summit/Paseo) at runtime without flipping ACTIVE_TESTNET_ENV. Unset PLAYGROUND_ENV => unchanged behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
getActiveEnv(), which resolves the active environment at runtime from thePLAYGROUND_ENVenv var (validated againstCONFIGS, trimmed), falling back to thebuild-time
DEFAULT_ENV.getChainConfig(),getNetworkLabel(),getTokenSymbol(),and
getPgasAssetId()now default to it instead ofDEFAULT_ENV.Why
Today
ACTIVE_TESTNET_ENVis the only network switch, and the direct-chain layer(
getConnection, pairing, registry, drip — every no-arggetChainConfig()reader) ispinned to
DEFAULT_ENV.runDeploy({ env })reroutes the deploy legs, but thedirect-chain reads can't follow it, so a host that wants to deploy to a non-default
wired env (e.g. deploying to Summit from a Paseo-default build) ends up split-brain:
storage/DotNS on one chain, funding/identity/registry on another.
Resolving the active env from
PLAYGROUND_ENVlets a single build point its own readsat any wired env at runtime — no rebuild, no
ACTIVE_TESTNET_ENVflip. The motivatingconsumer is the RevX deploy runner, which sets
PLAYGROUND_ENVper container from theuser's selected network.
Behaviour / compatibility
PLAYGROUND_ENVunset, behaviour is byte-identical tobefore (
getActiveEnv()→DEFAULT_ENV). Function signatures are unchanged; only thedefault-param source changed, so explicit-
envcallers (every command) are unaffected.PLAYGROUND_ENVvalues fall back toDEFAULT_ENV.Tests
src/config.test.tscovers: unset →DEFAULT_ENV, a wired value, surrounding whitespacetrimmed, garbage → fallback, and that the no-arg config + display helpers thread through
the override.